/**
 * 	Copyright 2011 rkehoe
 *
 * 	Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 * 	You may obtain a copy of the License at
 *
 *  http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *	limitations under the License.
 *
 */
package queryable.store;

import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import java.util.concurrent.locks.Lock;

import org.springframework.jdbc.core.RowMapper;

/**
 * Defines basic object store interface.
 * 
 * @author rkehoe
 *
 * @param <T>
 */
public interface IStore<T>
{
	public abstract int size();

	public abstract void add(T t);

	public abstract void addAll(Collection<T> list);
	
	public boolean isEmpty();

	public abstract void clear();
	
	public Iterator<T> iterator();

	public abstract int remove(String predicate, Object[] args);

	public abstract <R> List<R> select(String fields, String predicate, Object[] args, RowMapper<R> rowMapper);

	public abstract List<T> select(String predicate, Object[] args);
	
	/**
	 * Provides a read Lock that can be used with {@link #iterator()}.
	 * @return read Lock
	 */
	public abstract Lock readLock();
}